package com.aob.service.impl;

import com.aob.pojo.Customer;
import com.aob.mapper.CustomerMapper;
import com.aob.service.CustomerService;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * @Desc: 接口实现类
 * @Author: ChenWenJie
 */
@Service("customerService")
public class CustomerServiceImpl implements CustomerService {

    @Autowired(required = false)
    private CustomerMapper customerMapper;

    public CustomerMapper getCustomerMapper() {
        return customerMapper;
    }

    public void setCustomerMapper(CustomerMapper customerMapper) {
        this.customerMapper = customerMapper;
    }

    @Override
    public boolean add(Customer customer) {
        return customerMapper.add(customer)>0 ? true:false;
    }

    @Override
    public boolean deleteCustomerById(Integer id) {
        return customerMapper.deleteCustomerById(id)>0 ? true:false;
    }

    @Override
    public boolean update(Customer customer) {
        return customerMapper.update(customer)>0 ? true:false;
    }

    @Override
    public int getCustomerCount(Map<String, Object> map) {
        return customerMapper.getCustomerCount(map);
    }

    @Override
    public Customer getCustomerById(Integer id) {
        return customerMapper.getCustomerById(id);
    }

    @Override
    public List<Customer> getCustomerListByObj(Customer customer) {
        return customerMapper.getCustomerListByObj(customer);
    }

    @Override
    public List<Customer> getCustomerPageByMap(Map<String, Object> map) {
        return customerMapper.getCustomerPageByMap(map);
    }

    @Override
    public Customer getCustomerByMap(Map<String, Object> map) {
        return customerMapper.getCustomerByMap(map);
    }

    @Override
    public boolean checkEmail(String customerEmail) {
        return customerMapper.checkEmail(customerEmail)>0?true:false;
    }

    @Override
    public boolean checkTel(String customerTel) {
        return customerMapper.checkTel(customerTel)>0?true:false;
    }
}
